package com.wj.sort;

/**
 * @author wen.jie
 * @date 2021/8/5 15:46
 */
public abstract class AbstractSort {

    /**
     * 比较
     * @author wen.jie
     * @date 2021/8/4 17:18
     */
    protected static boolean greater(Comparable v, Comparable w) {
        return v.compareTo(w) > 0;
    }

    /**
     * v是否比w小
     * @author wen.jie
     * @date 2021/8/5 15:59
     */
    protected static boolean less(Comparable v, Comparable w){
        return greater(w, v);
    }

    /**
     * 交换
     * @author wen.jie
     * @date 2021/8/4 17:27
     */
    protected static void exchange(Comparable[] a, int i, int j) {
        Comparable temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }

}
